<template>
  <div id="app">
    <el-container>
      <el-header class="header">
        <div class="logo">
          <img src="" alt="" />
        </div>
        <el-menu
          :default-active="route.path"
          mode="horizontal"
          @select="handleSelect"
          :router="router"
          style="width: 50%"
        >
          <el-menu-item index="/">
            <span class="largeText">首页</span>
          </el-menu-item>
          <el-menu-item index="/introduction">
            <span class="largeText">学会介绍</span>
          </el-menu-item>
          <el-menu-item index="/work">
            <span class="largeText">党建工作</span>
          </el-menu-item>
          <el-menu-item index="/news">
            <span class="largeText">新闻</span>
          </el-menu-item>
          <el-menu-item index="/notice">
            <span class="largeText">通知公告</span>
          </el-menu-item>
          <el-menu-item index="/promotion">
            <span class="largeText">示范推广</span>
          </el-menu-item>
          <el-menu-item index="/service">
            <span class="largeText">会员服务</span>
          </el-menu-item>
        </el-menu>
      </el-header>
      <el-main>
        <el-carousel :interval="5000" arrow="always">
          <el-carousel-item
            v-for="item in carouselData"
            :key="item.id"
            class="h-full flex flex-col items-center justify-center"
            style="
              color: #fff;
              background: url(src/assets/img/img.png) no-repeat center;
              background-size: cover;
            "
          >
            <span class="col flex center h-full">
              <span style="font-size: xx-large; font-weight: 700">
                {{ item.title }}
              </span>
              <span style="font-size: x-large; font-weight: 600">
                {{ item.content }}
              </span>
            </span>
          </el-carousel-item>
        </el-carousel>
        <router-view :key="key" />
      </el-main>
      <div class="footer">
        <div class="footer-content">
          <ul class="content-nav">
            <li>
              <p>联系我们</p>
              <span>邮箱：zjh202303@qq.com</span>
              <span>电话：400xxx8888</span>
              <span>地址：湖北省武汉市江汉区建设大道430号</span>
            </li>
          </ul>
          <!-- <img src="./assets/img/ercode.png" alt="" /> -->
        </div>
        <div class="copyright">
          <span>湖北省综合运输研究会版权所有</span>
        </div>
      </div>
    </el-container>
  </div>
</template>

<script setup lang="ts">
import { computed, ref } from 'vue'
import { useRoute } from 'vue-router'
import { isMobile, watchResize } from '@bassist/utils'
import axios from 'axios'

axios.defaults.baseURL = 'http://119.29.216.71:35802'
const route = useRoute()
const key = computed(() => `${String(route.name || route.path)}-${new Date()}`)

watchResize(() => {
  document.body.className = `platform-${isMobile() ? 'mobile' : 'desktop'}`
})

const router = ref(true)
const defaultActive = ref('/')
const isShow = ref(false)
const carouselData = ref([
  {
    id: 0,
    title: '湖北省综合运输研究会',
    content: '湖北省综合运输研究会',
    imgSrc: '../assets/img/img.webp',
  },
  {
    id: 1,
    title: '湖北省综合运输研究会',
    content: '湖北省综合运输研究会',
    imgSrc: '../assets/img/img.webp',
  },
  {
    id: 2,
    title: '湖北省综合运输研究会',
    content: '湖北省综合运输研究会',
    imgSrc: '../assets/img/img.webp',
  },
])
function handleSelect(key: any) {
  isShow.value = defaultActive.value != key
  window.console.log(isShow.value)
}
</script>

<style lang="scss">
@import './index.css';

* {
  padding: 0;
  margin: 0;
}
html,
body {
  height: 100%;
}
#app {
  font-family: 'Avenir', Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color: #2c3e50;
}
.el-header {
  display: flex;
  justify-content: space-between;
  align-content: center;
  width: 100%;
  margin: 0 auto;
  background-color: #fff;

  .logo {
    width: 280px;
    padding: 10px 0 10px 10%;
    img {
      width: 100%;
      line-height: 60px;
    }
  }
}
.el-main {
  padding: 0 !important;
}

.footer {
  width: 100%;
  height: 220px;
  overflow: hidden;
  background-color: #14679f;
  &-content {
    width: 1240px;
    margin: 0 auto;
    padding-top: 20px;
    display: flex;
    justify-content: space-between;
    .content-nav {
      display: flex;
      justify-content: space-around;
      height: 170px;
      li {
        display: flex;
        flex-direction: column;
        padding: 0 20px;
        //justify-content: center;
        align-items: flex-start;
        p {
          font-size: 20px;
          color: #d4edff;
          padding: 10px 0;
        }
        span {
          color: #f7f7f7;
          font-weight: 300;
          padding: 5px 0;
        }
      }
    }
    img {
      width: 170px;
      height: 170px;
      padding: 10px;
    }
  }
  .copyright {
    height: 30px;
    background: #125688;
    display: flex;
    justify-content: center;
    span {
      color: #fff;
      line-height: 30px;
    }
  }
}
.el-tabs__item {
  color: #000 !important;
}
.el-tabs__item.is-active {
  color: whitesmoke !important;
  background-color: #3670ef !important;
}
.el-tabs__item.is-active:hover {
  color: whitesmoke !important;
}
.el-tabs__item:hover {
  color: #1747f4 !important;
}
.largeText {
  font-size: medium;
  font-weight: 600;
}
</style>
